/*
 * Copyright (c) 2015 qunar. All Rights Reserved.
 */
package com.guoyu.project.model.enums;

import java.util.Map;

import com.google.common.collect.Maps;

/**
 * @author: libo Date: 15-6-7 Time: 下午5:43
 */
public enum AnliType implements ArticleMinorType {
    /**
     * 人才培养
     */
    TRAINING(1, "人才培养"),
    /**
     * 科研创新
     */
    INNOVATION(2, "科研创新"),
    /**
     * 教育改革
     */
    SERVICE(3, "社会服务"),
    /**
     * 国际合作
     */
    COOPERATION(4, "国际合作"),;

    private int code;
    private String desc;

    AnliType(int code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    public String getDesc() {
        return desc;
    }

    public int getCode() {
        return code;
    }

    public String getName() {
        return this.name();
    }

    static Map<Integer, AnliType> codeMapper = Maps.newHashMap();
    static {
        for (AnliType newsType : values()) {
            codeMapper.put(newsType.getCode(), newsType);
        }
    }

    public static AnliType codeOf(int code) {
        return codeMapper.get(code);
    }
}
